//
//  ICApplicationModel.m
//  ICome
//
//  Created by zhang_rongwu on 16/3/8.
//  Copyright © 2016年 iCom. All rights reserved.
//

#import "ICApplicationModel.h"
#import "ICTools.h"
#import "ICApplicationNetworkManager.h"
#import "ICUser.h"
@implementation ICApplicationModel

- (instancetype)initWithDict:(NSDictionary *)dict {
    if (self = [super init]) {
        if ([dict isKindOfClass:[NSDictionary class]]) {
            [self setValuesForKeysWithDictionary:dict];
        }
    }
    return self;
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    if ([key isEqualToString:@"iosURL"]) {
        self.URL = value;
    }
    if ([key isEqualToString:@"iosScheme"]) {
        self.Scheme = value;
    }
}

+(void)getJsTicket:(void (^)(BOOL isSuccess, id object))success {
    NSDictionary *param = @{@"eId":[ICUser currentUser].eId};
    [[ICApplicationNetworkManager sharedInstance] getJsTicketWithObject:param success:^(id object) {
        [[NSUserDefaults standardUserDefaults] setObject:[[object objectForKey:@"data"] objectForKey:@"ticket"] forKey:@"JSTicket"];
        if (success) success(YES, object);
    } failure:^(NSError *error) {
        if (success) success(NO, nil);
    }];
}

@end



